name = '张三'
age = 23
my_str = 'my name is %s' % (name)
print(my_str)

my_str1 = "%s今年%d岁" % (name, age)

print(my_str1)
my_str2 = '一斤苹果%f元'% (3.56)
print(my_str2)
print('=======')
print('保留三位数字->''%.3f')
my_str3="my name is {}".format(name)
print(my_str3)
str1 = '{1}今年{0}岁'.format(name,age)
print(str1)
str1 = '{name} 今年{age}岁'.format(name=name,age=age)
print(str1)
str1 = 'some nothing everybody'
str2 = str1.split(' ')
print(str2)
print('查找是否有存在some:', str1.find('some'))
#str2 =('some', 'nothing', 'everybody')
#print('查找是否有存在some:', str2.find('some'))
str4='demo_rtyu_py'
print("是否以demo开头",str4.startswith("demo"))
print("是否以py结尾",str4.endswith('py'))
str5 = str4.replace('py','pj')
print(str5)

lst1 = [1,1,1,3,4,5,6]
tp1 = (1,2,3,4,5,6)
stry6 = '123defgjintke'
print("获取列表中的第2个元素:",lst1[1])
print("获取元组中的第2个元素:",tp1[1])
print("获取列表中的第2-5个元素:",lst1[1:5:])
alst = [1,2]
blst = [3,4]
print(alst + blst)
atp = [1,2]
btp = [1,1]
print(atp + btp)
str1 = 'hello'
str2 = 'world'
print(str1+str2)
dlst = alst *2
print(dlst)
str = '====='
print(atp*3)
print(str*4)
print()
tp3 = (1,2,3,4,5,6,7,8,9)
print(len(tp3))
print('产看tp3的长度:',len(tp3))
print('产看tp3的最大值:',max(tp3))
print('查看tp3的最小值:',min(tp3))
print('查看tp3的和:',sum(tp3))
print('对tp3进行排序:',sorted(tp3))
lst5=[4,3,2,8,7]
print(sorted(lst5))
lst5.sort()
print(lst5)
sorted(lst5)
#reversed
tp6 = (3,32,67,8,9)
print(reversed(tp6))
print(tp6)
for x in reversed(tp6):
    print(x,end=' ')
print(tp6)
for key,value in enumerate(tp6):
    print(key,'===',value)
print('将元组转换成列表:',list(tp6))
dct = {'a':1,'b':2}

print('将字典转化成字符串:',str({'a':1,'b':2}))
